package com.ruoyi.zxjd.work.service.impl;

import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.zxjd.work.domain.WorkTemplateTable8;
import com.ruoyi.zxjd.work.domain.bo.WorkProgressBO;
import com.ruoyi.zxjd.work.mapper.WorkTemplateTable8Mapper;
import com.ruoyi.zxjd.work.service.ICommonWorkTemplateTableService;
import com.ruoyi.zxjd.work.service.IWorkTemplateTable8Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 纪检监察机关反映问题线索处置情况登记Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-03-22
 */
@Service
public class WorkTemplateTable8ServiceImpl implements IWorkTemplateTable8Service
{
    @Autowired
    private WorkTemplateTable8Mapper workTemplateTable8Mapper;

    @Autowired
    private WorkProgressServiceImpl workProgressService;

    @Autowired
    private ICommonWorkTemplateTableService commonWorkTemplateTableService;

    /**
     * 查询纪检监察机关反映问题线索处置情况登记
     * 
     * @param id 纪检监察机关反映问题线索处置情况登记ID
     * @return 纪检监察机关反映问题线索处置情况登记
     */
    @Override
    public WorkTemplateTable8 selectWorkTemplateTable8ById(Long id)
    {
        return workTemplateTable8Mapper.selectWorkTemplateTable8ById(id);
    }

    /**
     * 查询纪检监察机关反映问题线索处置情况登记列表
     * 
     * @param workTemplateTable8 纪检监察机关反映问题线索处置情况登记
     * @return 纪检监察机关反映问题线索处置情况登记
     */
    @Override
    public List<WorkTemplateTable8> selectWorkTemplateTable8List(WorkTemplateTable8 workTemplateTable8)
    {
        return workTemplateTable8Mapper.selectWorkTemplateTable8List(workTemplateTable8);
    }

    /**
     * 新增纪检监察机关反映问题线索处置情况登记
     * 
     * @param workProgressBO 纪检监察机关反映问题线索处置情况登记
     * @return 结果
     */
    @Override
    public int insertWorkTemplateTable8(WorkProgressBO workProgressBO)
    {
        commonWorkTemplateTableService.insertOrUpdate(workProgressBO, "getWorkTemplateTable8", workTemplateTable8Mapper);

        return workProgressService.validate(workProgressBO.getWorkProgress());
    }

    /**
     * 修改纪检监察机关反映问题线索处置情况登记
     * 
     * @param workTemplateTable8 纪检监察机关反映问题线索处置情况登记
     * @return 结果
     */
    @Override
    public int updateWorkTemplateTable8(WorkTemplateTable8 workTemplateTable8)
    {
        workTemplateTable8.setUpdateBy(ShiroUtils.getLoginName());
        workTemplateTable8.setUpdateTime(DateUtils.getNowDate());
        return workTemplateTable8Mapper.updateWorkTemplateTable8(workTemplateTable8);
    }

    /**
     * 删除纪检监察机关反映问题线索处置情况登记对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteWorkTemplateTable8ByIds(String ids)
    {
        return workTemplateTable8Mapper.deleteWorkTemplateTable8ByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除纪检监察机关反映问题线索处置情况登记信息
     * 
     * @param id 纪检监察机关反映问题线索处置情况登记ID
     * @return 结果
     */
    @Override
    public int deleteWorkTemplateTable8ById(Long id)
    {
        return workTemplateTable8Mapper.deleteWorkTemplateTable8ById(id);
    }
    
    @Override
    public List<WorkTemplateTable8> selectWorkTemplateTable8ByProgressId(Long progressId) {
        WorkTemplateTable8 workTemplateTable8 = new WorkTemplateTable8();
        workTemplateTable8.setProgressId(progressId);

        return   workTemplateTable8Mapper.selectWorkTemplateTable8List(workTemplateTable8);
    }


    @Override
    public WorkTemplateTable8 selectWorkTemplateTableByProgressIdLimit1(Long progressId) {
        return workTemplateTable8Mapper.selectWorkTemplateTableByProgressIdLimit1(progressId);
    }
}
